<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
    <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<h1>Netty-socketio示例</h1>
<br/>
<div id="console" class="well">
</div>
<form class="well form-inline" onsubmit="return false;">
    <input id="gameName" class="input-xlarge" type="text" placeholder="游戏名称"/>
    <input id="name" class="input-xlarge" type="text" placeholder="用户名称"/>
    <input id="uid" class="input-xlarge" type="text" placeholder="用户ID"/>
    <button type="button" onClick="joinRoom()" class="btn">joinRoom</button>
    <button type="button" onClick="sendDisconnect()" class="btn">Disconnect</button>
</form>
</body>
<script type="text/javascript">
    var socket =  io.connect('http://localhost:8848');

     socket.on('connect', function() {
         console.log("Client has connected to the server!");
     });

     socket.on('gameStatus', function(data) {
         console.log(data);
     });

     socket.on('disconnect', function() {
         console.log("Client has disconnected from the server!");
     });
     function sendDisconnect() {
         socket.disconnect();
     }

     function joinRoom() {
         var param = {name: $("#name").val(), uid: $("#uid").val(), gameName:$("#gameName").val()};
         socket.emit('joinRoom', JSON.stringify(param));
     }

</script>
</html>